<?php
declare (strict_types=1);

namespace app\api\controller;

use app\common\tool\Result;
use think\facade\View;
use think\response\Json;
use app\common\model\Worker as WorkerModel;

class Worker extends Base
{

    /**
     * get: 师傅列表
     * path: getList
     * method: getList
     * param: page - page
     */
    public function getList(): \think\Response
    {
        $param = $this->request->param();
        $map = ['is_del' => 0, 'status' => 1];
        $list = WorkerModel::getPageList($map, 'id,name,mobile,excel,images,province,city,district,town,details', $param['page'], 20, true,['p', 'c', 'd', 't']);
        foreach ($list['data'] as $k=>$v){
            $v->excel = handleRichText($v->excel);
        }
        if($list['code']>0)
        {
            return Result::success('获取成功',$list);
        }else{
            return Result::fail('获取失败');
        }
    }

}

